/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * invulgotracker
 * Copyright (C) Thomas Andersen 2011 <thomas.1.andersen@gmail.com>
 * 
 * invulgotracker is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * invulgotracker is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _PREFS_H_
#define _PREFS_H_

#include <gtk/gtk.h>

#include "taskid.h"
#include "i-notify.h"
#include "task-time.h"

class Prefs
{
public:
    Prefs();
    virtual ~Prefs();

    void Show(INotify *subscriber = NULL);

    bool GetHideOnMinimize() { return hideOnMinimize; }
    bool GetHideOnClose() { return hideOnClose; }
    bool GetWarnOnDate() { return warnOnDate; }
    bool GetWarnOnTaskDelete() { return warnOnTaskDelete; }
    bool GetWarnOnTimeDelete() { return warnOnTimeDelete; }
    bool GetInsertEndTask() { return insertEndTask; }
    TaskId GetEndTaskId() { return endTaskId; }
    TaskId GetSickTaskId() { return sickTaskId; }
    TaskId GetHolidayTaskId() { return holidayTaskId; }
    bool GetSaveWindowSizes() { return saveWindowSizes; }
    gint GetSavedWindowWidth() { return savedWindowWidth; }
    void SetSavedWindowWidth(gint width) { savedWindowWidth = width; }
    gint GetSavedWindowHeight() { return savedWindowHeight; }
    void SetSavedWindowHeight(gint height) { savedWindowHeight = height; }
    void SetSavedVPanePosition(gint pos) { savedVPanePosition = pos; }
    void SetSavedHPanePosition(gint pos) { savedHPanePosition = pos; }
    gint GetSavedVPanePosition() { return savedVPanePosition; }
    gint GetSavedHPanePosition() { return savedHPanePosition; }
    bool GetSavedWindowMaximized() { return savedWindowMaximized; }
    void SetSavedWindowMaximized(bool maxed) { savedWindowMaximized = maxed; }
    void Save();
    void Response(gint responseId);
    bool GetShowSummaryPercentage() { return showSummaryPercentage; }
    bool GetHideTaskDone() { return hideTaskDone; }
    void SetHideTaskDone(bool hide) { hideTaskDone = hide; }

    const gchar *GetColorDone();
    const gchar *GetColorDeadline();

    /** Returns workhours of weekday in minutes. */
    int GetWorkhours(int weekDay);
    TaskTime GetWorkdayStart(int weekday);
    TaskTime GetWorkdayEnd(int weekday);
    /**
      * Events.
      */
    enum {
        SAVED = 100
    };
protected:

private:
    void Load();
    void EntrySet(char *label, char *txt);
    void EntryGet(char *label, TaskTime *tt);

    bool hideOnMinimize;
    bool hideOnClose;
    bool warnOnDate;
    bool warnOnTaskDelete;
    bool warnOnTimeDelete;
    bool insertEndTask;
    bool saveWindowSizes;
    bool savedWindowMaximized;
    gint savedWindowWidth;
    gint savedWindowHeight;
    gint savedVPanePosition;
    gint savedHPanePosition;
    bool showSummaryPercentage;
    bool hideTaskDone;
    TaskTime workhourMonFrom;
    TaskTime workhourMonTo;
    TaskTime workhourTueFrom;
    TaskTime workhourTueTo;
    TaskTime workhourWedFrom;
    TaskTime workhourWedTo;
    TaskTime workhourThuFrom;
    TaskTime workhourThuTo;
    TaskTime workhourFriFrom;
    TaskTime workhourFriTo;
    TaskTime workhourSatFrom;
    TaskTime workhourSatTo;
    TaskTime workhourSunFrom;
    TaskTime workhourSunTo;

    TaskId endTaskId;
    TaskId sickTaskId;
    TaskId holidayTaskId;
    GtkWidget *endWidget;
    GtkWidget *sickWidget;
    GtkWidget *holidayWidget;
    GtkWidget *window;
    gulong responseHandler;
    INotify *subscriber;
    long doneColor;
    long deadlineColor;
    static const gchar *colorText[];
    static const gchar *colorValue[];
};

#endif // _PREFS_H_
